/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.svh.Paginator;

import com.svh.Entidad.Perfil;
import com.svh.Entidad.Usuario;
import com.svh.Hibernate.HibernatePaginator;
import com.svh.Utils.Estado;
import org.hibernate.HibernateException;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

/**
 *
 * @author Luis Alonso Ballena Garcia
 */
public class PerfilPaginator extends HibernatePaginator<Perfil>{

    public PerfilPaginator() {
        super();
    }

    @Override
    public void initFiltro() {
        DetachedCriteria criteria = null;
        try{
            criteria = DetachedCriteria.forClass(Perfil.class,"perfil").add(Restrictions.eq("perfil.estado",Estado.ACTIVO.getValor()));
            super.filtroCriteria = criteria;
        }catch(HibernateException e){
            e.printStackTrace();
        }catch(Exception e)
        {
            e.printStackTrace();
        }
    }
    
}
